package com.basic.system.dao.mapper;

import com.basic.system.domain.SystemFile;
import com.basic.system.domain.SystemFileExample;
import java.util.List;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface SystemFileMapper {
    long countByExample(SystemFileExample example);

    int deleteByExample(SystemFileExample example);

    int deleteByPrimaryKey(Long id);

    int insert(SystemFile record);

    int insertSelective(SystemFile record);

    List<SystemFile> selectByExample(SystemFileExample example);

    SystemFile selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") SystemFile record, @Param("example") SystemFileExample example);

    int updateByExample(@Param("record") SystemFile record, @Param("example") SystemFileExample example);

    int updateByPrimaryKeySelective(SystemFile record);

    int updateByPrimaryKey(SystemFile record);
    //根据ref_Id查出对应的信息 对应system_manager 的根据主键联查业务
    List<SystemFile> selectByRefIdAfter(@Param("id") Long id);
    //根据制度表与文件表关联的ref_id 进行删除
    int deleteByRefIdAfter(Long id);
    //批量删除文件表的数据根据文件表与制度表关联的ref_id进行删除
    int deleteBatchSystemFile(@Param("ids") List<Long> ids);
    //查询文件表关联ref_id的文件数量有几个 为删除单点数据判空做准备
    @Select("SELECT COUNT(*) FROM system_file WHERE ref_id = #{id}")
    int selCountRef( @Param("id") Long id);


}